export function limit(name: string, num: number) {
    const checks: NodeListOf<HTMLElement> = document.getElementsByName(name);
    const checked: number[] = []
    Array.prototype.forEach.call(checks, function (option) {
        if (option.checked) {
            checked.push(option.value);
        }
    });
    if (checked.length >= num) {
        Array.prototype.forEach.call(checks, function (option) {
            if (!option.checked) {
                option.disabled = true;
            } else {
                option.disabled = false;
            }
        });
    } else {
        Array.prototype.forEach.call(checks, function (option) {
            option.disabled = false;
        });
    }
}